package com.spzx.product.api;

import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.domain.SkuStock;
import com.spzx.product.domain.dto.SkuStockDTO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = ServiceNameConstants.PRODUCT_SERVICE,
fallbackFactory = RemoteSkuStockFallbackFactory.class)
public interface RemoteSkuStockService {

    @Operation(summary = "内部调用接口：根据skuId查询库存数据")
    @GetMapping("stock/getSkuStock/{skuId}")
    public R<SkuStock> getSkuStock(@PathVariable("skuId")Long skuId);

    @Operation(summary = "内部调用接口：提交订单验库存锁库存")
    @PostMapping("/stock/checkAndLockSkuStock")
    public R<List<SkuStockDTO>> checkAndLockSkuStock(@RequestBody List<SkuStockDTO> skuStockDTOS);
}
